package dq.study.designmodel.proxy.dynamic;

import dq.study.designmodel.proxy.Tank;

import java.lang.reflect.Method;

/**
 * @author dongqun
 * @Description:
 * @date 2019/3/31 22:07
 */
public class LogInvokeHandler implements InvokeHandler {

    Tank target;

    public LogInvokeHandler(Tank target) {
        this.target = target;
    }

    @Override
    public void invoke(Object proxy, Method method) {
        System.out.println("开始方法......");
        try {
            method.invoke(target);
        } catch (Exception e) {
            e.printStackTrace();
        }
        System.out.println("结束方法......");
    }
}
